package com.harold.sina.weido;

import android.app.Activity;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.sina.weibo.sdk.auth.AuthInfo;
import com.sina.weibo.sdk.web.WeiboPageUtils;

/**
 * Created by Administrator on 2017/6/20.
 */



public class WeiboPageActivity extends Activity {


    private AuthInfo authInfo;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_weibo_page);
        NavigationView navigationView = (NavigationView) findViewById(R.id.navigation_view);
        authInfo = new AuthInfo(this, Constants.APP_KEY, Constants.REDIRECT_URL, Constants.SCOPE);
        navigationView.setItemIconTintList(null);

        navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(MenuItem item) {
                switch (item.getItemId()) {
                    case R.id.nav_all:
                        WeiboPageUtils.getInstance(WeiboPageActivity.this, authInfo).gotoMyHomePage(true);
                        break;
                    case R.id.nav_comment:
                        WeiboPageUtils.getInstance(WeiboPageActivity.this, authInfo).commentWeibo("1498094594213",false);
                        break;
                    case R.id.nav_follow:
                        WeiboPageUtils.getInstance(WeiboPageActivity.this, authInfo).gotoMyProfile(true);
                        break;
                    case R.id.nav_search:
                        WeiboPageUtils.getInstance(WeiboPageActivity.this, authInfo).openWeiboSearchPage("123", true);
                }
                return false;
            }
        });
    }
}



